<?php
include("./API.php");
include("../config.php");
tongji("qun_fgg");
$hh=$_GET['hh']?:"\n";//换行符号(默认\n)
$url="https://web.qun.qq.com/cgi-bin/announce/add_qun_notice?bkn=910068286";
$data='qid='.$_GET["group"].'&bkn='.getGTK($_GET["skey"]).'&text='.$_GET["text"].'&pinned=0&type=1&settings=%7B%22is_show_edit_card%22%3A0%2C%22tip_window_type%22%3A1%2C%22confirm_required%22%3A1%7D';
$return_content=http_post_data($url, $data);
$pst= json_decode($return_content);
$hw_id=$pst->ec;
if($hw_id==0){
echo "".$web["ming"]."API♧QQ群发公告".$hh."";
echo "━━━━━━━━━".$hh."";
echo '发送成功'.$hh.'';
echo "━━━━━━━━━".$hh."";
echo "Tips:".$web["ming"]."API技术支持";
}else
if($hw_id==1){
echo "".$web["ming"]."API♧QQ群发公告".$hh."";
echo "━━━━━━━━━".$hh."";
echo '参数错误'.$hh.'';
echo "━━━━━━━━━".$hh."";
echo "Tips:".$web["ming"]."API技术支持";
}
function getGTK($skey){
$len = strlen($skey);
$hash = 5381;
for ($i = 0; $i < $len; $i++) {
$hash += ($hash << 5 & 2147483647) + ord($skey[$i]) & 2147483647;
$hash &= 2147483647;
}
return $hash & 2147483647;
}

function http_post_data($url, $data_string) {
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
	curl_setopt($ch, CURLOPT_HTTPHEADER, array(
	"Content-Type: application/x-www-form-urlencoded",
		"Content-Length: " . strlen($data_string),
		"Cookie: p_uin=o".$_GET["qq"]."; uin=o".$_GET["qq"]."; skey=".$_GET["skey"]."; p_skey=".$_GET["pskey"]
		));
	ob_start();
	curl_exec($ch);
	$return_content = ob_get_contents();
	ob_end_clean();
	return $return_content;
}
?>